package com.itheima.flowcontrol.loop;

/**
 * 使用for循环 求取水仙花数
 */
public class ForPractise03 {
    public static void main(String[] args) {
        test01();

    }
    public static void test01() {
        //1.求取水仙花数 水仙花数是一个三位数
        int sxhs = 0;
        int count = 0;
        for (int i = 100; i < 999; i++) {
            //2.提取数字的个 十 百 153
            int ge = i % 10 ;
            int shi = i / 10 % 10 ;
            int bai = i / 100;
            if((ge * ge * ge + shi * shi * shi+ bai * bai * bai) == i) {
                sxhs = i;
                System.out.println(sxhs);
                count++;
            }
            }
        System.out.println("水仙花数的个数是");
        System.out.println(count);
        }
    }

